﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.Mapping;

namespace Coleotrack.Data.Maps
{
    public class IssueMap : ClassMap<Issue>
    {
        public IssueMap()
        {
            Id(x => x.Id).GeneratedBy.Identity();

            Map(x => x.Title).Not.Nullable().Length(255);
            Map(x => x.Description).Not.Nullable().Length(10000);
            Map(x => x.Due).Nullable();

            References(x => x.Area).Not.Nullable();
            References(x => x.AssignedTo).Not.Nullable();
            References(x => x.Category).Not.Nullable();
            Component(x => x.Effort);
            References(x => x.Parent).Nullable();
            References(x => x.Priority).Not.Nullable();
            References(x => x.Project).Not.Nullable();
            References(x => x.ReportedForRelease).Nullable();
            References(x => x.SolvedInRelease).Nullable();
            References(x => x.Status).Not.Nullable();

            HasManyToMany(x => x.Tags).Cascade.SaveUpdate();
        }
    }
}
